<script src="/js/plugins/validation/jquery.validate.min.js"></script>
<script src="/js/plugins/validation/additional-methods.min.js"></script>
<div class="row-fluid">


    <div class="span12">
        <div class="box box-bordered box-color">
            <div class="box-title">
                <h3><i class="icon-th-list"></i> Editar Usuario</h3>
            </div>
            <div class="box-content nopadding">
                <form action="<?php echo url_for('admin/updateUser'); ?>" method="POST" class='form-horizontal form-bordered form-validate' id="users">
                    <input type="hidden" name="users[id]" value="<?php echo $user[0]['id_users'];?>" />


                    <div class="control-group">
                        <label for="nombres" class="control-label">Nombres</label>
                        <div class="controls">
                            <input type="text" name="users[name]" id="nombres" value="<?php echo $user[0]['name']; ?>" placeholder="Nombres" class="input-xlarge" data-rule-required="true" data-msg-required="Debe Ingresar el Nombre" data-rule-minlength="3" data-msg-minlength="El Nombre debe ser Mayor a 2 caracteres">
                        </div>
                    </div>
                    <div class="control-group">
                        <label for="apellidos" class="control-label">Apellidos</label>
                        <div class="controls">
                            <input type="text" name="users[last_name]" id="apellidos" value="<?php echo $user[0]['last_name']; ?>" placeholder="Apellidos" class="input-xlarge" data-rule-required="true" data-msg-required="Debe Ingresar los Apellidos" data-rule-minlength="3" data-msg-minlength="El Nombre debe ser Mayor a 2 Caracteres">
                        </div>
                    </div>
                    <div class="control-group">
                        <label for="email" class="control-label">Email</label>
                        <div class="controls">
                            <input type="text" name="users[email]" id="email" value="<?php echo $user[0]['email']; ?>" placeholder="Email" class="input-xlarge" data-rule-required="true" data-msg-required="Debe Ingresar el Email" data-rule-email="true" data-msg-email="Debe indicar un Email Valido">
                        </div>
                    </div>
                    <div class="control-group">
                        <label for="telefono" class="control-label">Teléfono</label>
                        <div class="controls">
                            <input type="text" name="users[phone_number]" id="telefono" value="<?php echo $user[0]['phone_number']; ?>" placeholder="Teléfono" class="input-xlarge" data-rule-number="true" data-msg-number="Debe Ingresar Solo Números">
                        </div>
                    </div>
                    <div class="control-group">
                        <label for="username" class="control-label">Username</label>
                        <div class="controls">
                            <input type="text" name="users[username]" id="username" disabled="" value="<?php echo $user[0]['name']; ?>" placeholder="Username" class="input-xlarge" data-rule-required="true" data-msg-required="Debe ingresar el Username"  data-rule-remote="<?php echo url_for('admin/valUsers'); ?>" data-msg-remote="Usuario Existe" data-rule-minlength="5" data-msg-minlength="El Username debe ser Mayor a 5 Caracteres">
                        </div>
                    </div>
                    <div class="control-group">
                        <label for="password" class="control-label">Password</label>
                        <div class="controls">
                            <input type="text" name="users[password]" id="password" placeholder="Password" class="input-xlarge" data-rule-required="false" data-msg-required="Debe ingresar el Password" data-rule-minlength="5" data-msg-minlength="El Password debe ser Mayor a 5 Caracteres">
                        </div>
                    </div>
                    <div class="control-group">
                        <label for="permisos" class="control-label">Permisos</label>
                        <div class="controls">

                            <select multiple="multiple" id="permisos" name="capabilitys[]" class='multiselect'  data-selectableheader="Listado Permisos" data-selectionheader="Permisos Asignados" data-rule-required="true" data-msg-required="Debe Seleccionar los Permisos del Usuario">
                                <?php foreach ($caps as $value) { ?>
                                    <option value='<?php echo $value[0]; ?>' <?php echo $value[1]; ?>><?php echo $value[2]; ?></option>
                                <?php } ?>

                            </select>
                        </div>
                    </div>


                    <div class="form-actions">
                        <button type="submit" class="btn btn-primary">Guardar</button>
                        <button type="button" class="btn">Cancelar</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>